package com.jh.paymentchannel.repository;

import com.jh.paymentchannel.pojo.JFCoinRegister;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;


@Repository
public interface JFCoinRepository extends JpaRepository<JFCoinRegister, String>, JpaSpecificationExecutor<JFCoinRegister>{
	
	@Query("select jfc from  JFCoinRegister jfc where jfc.userId=:userId and jfc.bankCard=:bankCard")
	public JFCoinRegister	getJFCoinRegisterByUseridAndBankCard(@Param("userId") long userId, @Param("bankCard") String bankCard);
	
	@Query("select jfc from  JFCoinRegister jfc where jfc.userId=:userId")
	public JFCoinRegister	getJFCoinRegisterByUserid(@Param("userId") long userId);
	
	//注销用户记录
	@Modifying
	@Query("delete from JFCoinRegister jfc where jfc.userId=:userid")
	void delJFCoinRegisterByUserid(@Param("userid") long userid);
}
